package com.yjd.pub.device.service;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.comm.device.model.MerchantDeviceModel;
import com.yjd.comm.device.service.IMerchantDeviceService;
import com.yjd.pub.device.dao.IMerchantDeviceDao;

/**
 * <b>description</b>：商户设备信息表业务实现<br>
 * <b>time</b>：2017-11-27 10:33:36 <br>
 * <b>author</b>：  yangchangyan@yijiedai.com
 */
@Service("merchantDeviceService")
public class MerchantDeviceServiceImpl extends BaseServiceImpl implements IMerchantDeviceService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public MerchantDeviceModel insert(MerchantDeviceModel model) throws Exception {
		return this.merchantDeviceDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(MerchantDeviceModel model) throws Exception {
		return this.merchantDeviceDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param device_id
	 * @return
	 * @throws Exception
	 */
	public int delete(long device_id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("device_id", device_id);
		return this.merchantDeviceDao.deleteModel(paramMap, true);
	}

	@Resource
	private IMerchantDeviceDao merchantDeviceDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.merchantDeviceDao;
	}

}
